import {
    CHANGE_TOP_BANNERS,
    CHANGE_HOT_RECOMMEND,
    CHANGE_NEW_ALBUM,
    CHANGE_UP_RANKING,
    CHANGE_NEW_RANKING,
    CHANGE_ORIGIN_RANKING,
    CHANGE_SETTLE_SINGER
} from "./constants";

import { Map } from "immutable";


//推荐板块的数据
const defaultState = Map({
    topBanners: [],
    hotRecommends: [],
    newAlbums: [],

    upRanking: {},// 云音乐飙升榜
    newRanking: {},//  云音乐新歌榜数据
    originRanking: {},// 网易原创歌曲榜

    settleSings: [],//入住歌手数据
});

function reducer (state = defaultState, action) {
    switch (action.type) {
        case CHANGE_TOP_BANNERS:
            // return {...state, topBanners: action.topBanners}
            return state.set("topBanners", action.topBanners)
        case CHANGE_HOT_RECOMMEND:
            return state.set("hotRecommends", action.hotRecommends)

        case CHANGE_NEW_ALBUM:
            return state.set("newAlbums", action.newAlbums)

        case CHANGE_UP_RANKING:
            return state.set("upRanking", action.playlist)

        case CHANGE_NEW_RANKING:
            return state.set("newRanking", action.playlist)

        case CHANGE_ORIGIN_RANKING:
            return state.set("originRanking", action.playlist)

        case CHANGE_SETTLE_SINGER:
            return state.set("settleSings", action.settleSings)

        default:
            return state;
    }
}

export default reducer
